package com.juxing.webserver.common;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回码常量
 * @author brochen
 * @mail mongibello@163.com
 * @created 2016年2月4日
 *
 */
public class ReturnCodeConstant {

	private static final Map<String, String> errMsgMap = new HashMap<String, String>();
	
	public static final String SUCCESS = "0";//成功
	
	//COMMON CODE
	public static final String SERVER_ERROR = "99";//服务器异常
	public static final String PARAM_ERROR = "100";//参数错误
	public static final String USER_NOT_EXIST = "110";//用户不存在
	public static final String USER_FORBID = "111";//用户被禁用
	public static final String SMS_SEND_FREQUENCY = "112";//手机验证码获取频繁
	public static final String MOBILE_CHK_CODE_ERROR = "113";//手机验证码错误
	public static final String GRAPH_CHK_CODE_ERROR = "114";//图形验证码错误
	
	//账号模块
	public static final String ACCOUNT_EXISTED = "201";//账号已存在
	public static final String ACCOUNT_PWD_NOT_MATCHED = "202";//账号密码不匹配
	public static final String ACCOUNT_NICKNAME_EXISTED = "203";//昵称已存在
	
	
	//错误码及错误信息
	static{
		errMsgMap.put(SUCCESS, "ok");
		errMsgMap.put(SERVER_ERROR, "服务器异常");
		errMsgMap.put(PARAM_ERROR, "参数错误");
		errMsgMap.put(USER_NOT_EXIST, "用户不存在");
		errMsgMap.put(USER_FORBID, "用户被禁用");
		errMsgMap.put(SMS_SEND_FREQUENCY, "获取手机验证码频繁");
		errMsgMap.put(MOBILE_CHK_CODE_ERROR, "手机验证码输入错误");
		errMsgMap.put(GRAPH_CHK_CODE_ERROR, "图形验证码输入错误");
		
		errMsgMap.put(ACCOUNT_EXISTED, "账号已存在");
		errMsgMap.put(ACCOUNT_PWD_NOT_MATCHED, "账号密码不匹配");
		errMsgMap.put(ACCOUNT_NICKNAME_EXISTED, "昵称已存在");
	}
	
	/**
	 * 获取错误消息
	 * @param errorCode
	 * @return
	 */
	public static String getErrorMsg(String errorCode) {
		return errMsgMap.get(errorCode);
	}
}
